// pages/video/video.js
import Model from './model'
let model = new Model()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    lessonInfo: {},
    comContent: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var id = 5
    model.getlesson(id).then(ret => {
      this.setData({
        lessonInfo: ret.data.data
      })
    })
  },
  postdata(evt) {
    var openid = wx.getStorageSync('openid')
    var lesson_id = this.data.lessonInfo.id
    var content = evt.detail.value.content
    model.sendcomment({openid ,lesson_id, content}).then(ret=> {
      wx.showToast({
        title: '评论成功',
        icon:"success",
        duration: 1500,
        mask: true
      });
      this.setData({
        comContent: ''
      })
    })
  }

})